package cn.edu.scau.cmi.zhengweixin.all;

import java.io.IOException;
import java.net.URL;
import java.util.ResourceBundle;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.image.ImageView;
import javafx.stage.Stage;


public class Controller {

    @FXML
    private ResourceBundle resources;

    @FXML
    private URL location;

    @FXML
    private Button abstractFactoryButton;

    @FXML
    private Button adapterButton;

    @FXML
    private Button consistencyCompositeButton;

    @FXML
    private Button factoryButton;

    @FXML
    private Button multipletonButton;

    @FXML
    private ImageView photo;

    @FXML
    private Button safeCompositeButton;

    @FXML
    private Button simpleFactoryButton;

    @FXML
    private Button singletonButton;

    @FXML
    private Button teachButton;


    @FXML
    void toAbstractFactory(ActionEvent event) throws IOException {
    	Parent root = FXMLLoader.load(getClass()
                .getResource("../abstractFactory/Factory.fxml"));
    	Stage stage = new Stage();
    	stage.setTitle("抽象工厂模式");
    	stage.setScene(new Scene(root));
    	stage.show();
    }

    @FXML
    void toAdapter(ActionEvent event) throws IOException {
    	Parent root = FXMLLoader.load(getClass()
                .getResource("../adapter/Adapter.fxml"));
    	Stage stage = new Stage();
    	stage.setTitle("适配器模式");
    	stage.setScene(new Scene(root));
    	stage.show();
    }

    @FXML
    void toConsistencyComposite(ActionEvent event) throws IOException {
    	Parent root = FXMLLoader.load(getClass()
                .getResource("../composite/consistency/ConsistencyComposite.fxml"));
    	Stage stage = new Stage();
    	stage.setTitle("一致性组合模式");
    	stage.setScene(new Scene(root));
    	stage.show();
    }

    @FXML
    void toFactory(ActionEvent event) throws IOException {
    	Parent root = FXMLLoader.load(getClass()
                .getResource("../factory/Factory.fxml"));
    	Stage stage = new Stage();
    	stage.setTitle("工厂模式");
    	stage.setScene(new Scene(root));
    	stage.show();
    }

    @FXML
    void toMultipleton(ActionEvent event) throws IOException {
    	Parent root = FXMLLoader.load(getClass()
                .getResource("../singleton/Multipleton.fxml"));
    	Stage stage = new Stage();
    	stage.setTitle("多例模式");
    	stage.setScene(new Scene(root));
    	stage.show();
    }

    @FXML
    void toSafeComposite(ActionEvent event) throws IOException {
    	Parent root = FXMLLoader.load(getClass()
                .getResource("../composite/safe/SafeComposite.fxml"));
    	Stage stage = new Stage();
    	stage.setTitle("安全组合模式");
    	stage.setScene(new Scene(root));
    	stage.show();
    }

    @FXML
    void toSimpleFactory(ActionEvent event) throws IOException {
    	Parent root = FXMLLoader.load(getClass()
                .getResource("../factory/SimpleFactory.fxml"));
    	Stage stage = new Stage();
    	stage.setTitle("简单工厂模式");
    	stage.setScene(new Scene(root));
    	stage.show();
    }

    @FXML
    void toSingleton(ActionEvent event) throws IOException {
    	Parent root = FXMLLoader.load(getClass()
                .getResource("../singleton/Singleton.fxml"));
    	Stage stage = new Stage();
    	stage.setTitle("Singleton");
    	stage.setScene(new Scene(root));
    	stage.show();
    }

    @FXML
    void toTeach(ActionEvent event) throws IOException {
    	Parent root = FXMLLoader.load(getClass()
                .getResource("Teach.fxml"));
    	Stage stage = new Stage();
    	stage.setTitle("教师指导学生毕业设计");
    	stage.setScene(new Scene(root));
    	stage.show();
    }

    @FXML
    void initialize() {
        assert abstractFactoryButton != null : "fx:id=\"abstractFactoryButton\" was not injected: check your FXML file 'All.fxml'.";
        assert adapterButton != null : "fx:id=\"adapterButton\" was not injected: check your FXML file 'All.fxml'.";
        assert consistencyCompositeButton != null : "fx:id=\"consistencyCompositeButton\" was not injected: check your FXML file 'All.fxml'.";
        assert factoryButton != null : "fx:id=\"factoryButton\" was not injected: check your FXML file 'All.fxml'.";
        assert multipletonButton != null : "fx:id=\"multipletonButton\" was not injected: check your FXML file 'All.fxml'.";
        assert photo != null : "fx:id=\"photo\" was not injected: check your FXML file 'All.fxml'.";
        assert safeCompositeButton != null : "fx:id=\"safeCompositeButton\" was not injected: check your FXML file 'All.fxml'.";
        assert simpleFactoryButton != null : "fx:id=\"simpleFactoryButton\" was not injected: check your FXML file 'All.fxml'.";
        assert singletonButton != null : "fx:id=\"singletonButton\" was not injected: check your FXML file 'All.fxml'.";
        assert teachButton != null : "fx:id=\"teachButton\" was not injected: check your FXML file 'All.fxml'.";
    }

}
